package com.group.transaction.controller;

import com.alibaba.fastjson.JSONObject;
import com.group.transaction.aspect.InMethod;
import com.group.transaction.domain.User;
import com.group.transaction.model.ResultJson;
import com.group.transaction.service.permission.PermissionService;
import lombok.Data;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@Data
@RequestMapping("/permission")
public class PermissionController {

    @Resource
    private PermissionService permissionService;

    private Integer roleId;

    /**
     * 查询权限值
     * @return
     */
    @InMethod(apiName = "查询权限")
    @GetMapping ("/queryAllPermissionData")
    public JSONObject queryAllPermissionData () {
        return permissionService.queryAllPermissionData();
    }

    /**
     * 根据角色id查询权限
     * @return
     */
    @InMethod(apiName = "根据角色id查询权限")
    @GetMapping ("/queryPermissionByRoleId")
    public JSONObject queryPermissionByRoleId (@RequestParam("roleId")Integer roleId) {
        return permissionService.queryPermissionByRoleId(roleId);
    }
}
